﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Battle
{
    public class Bullet_Bomb:BulletBase
    {
        protected override void OnHitObj(ICanHitObj target)
        {
            if (hitHandler != null||BulletData.rangeData.dRadius<=0)
                base.OnHitObj(target);
            else
            {
                var enemys = EnemyMgr.Ins.GetEnemysInRange(transform.position, (float)BulletData.rangeData.dRadius);

                for (int i = 0; i < enemys.Length; i++)
                {
                    enemys[i].OnHit(new ST_HitActionData(BulletData.nDmg, BulletData.nRepelNum
                        , (enemys[i].Pos - transform.position).normalized));
                }

                //爆炸特效
                EffMgr.CreateExplodeEffAsync(transform.position, BulletData.rangeData, UnityEngine.Color.white);

                AfterHitObj(target);
            }
        }
    }
}
